<template>
  <div class="home">
    <swiper/>
    <div class="section" v-for="(item,index) in songsList" :key="index">
      <div class="section-title">{{item.name}}</div>
        <content-list :contentList="item.list"></content-list>
    </div>

  </div>
</template>

<script>
  import {getAllSinger,getAllSongList} from '../api/index'
import Swiper from '../components/Swiper'
  import ContentList from '../components/ContentList'
export default {
  name: 'home',
  components: {
    ContentList,
    Swiper

  },
  data () {
    return {
      songsList:[
        {name:'歌单',list:[]},
        {name:'歌手',list:[]}
      ]
    }
  },
  created () {
    this.getSinger()
    this.getSongList()
  },
  methods: {
    getSinger(){
      getAllSinger().then(res =>{
        this.songsList[1].list = res.slice(0,10)
      }).catch(err =>{
        console.log(err)
      })
    },
    getSongList(){
      getAllSongList().then(res =>{
        this.songsList[0].list = res.slice(0,10)
      }).catch(err =>{
        console.log(err)
      })
    }
  }
}
</script>

<style lang="scss" scoped>
@import '../assets/css/home.scss';
</style>
